{	Problem: http://codeforces.ru/problemset/problem/103/B
	Verdict: Accepted
}
uses
    SysUtils, Math;

const
    YES = 'FHTAGN!';
    NO = 'NO';

var
    n,m,i,x,y,tt:longint;
    l,g:array[0..110] of longint;

function go(v:longint):longint;
begin
if l[v] <> v then
    l[v]:=go(l[v]);
result:=l[v];
end;

procedure un(x,y:longint);
begin
x:=go(x);
y:=go(y);
l[x]:=y;
end;

begin 
read(n,m);
if m <> n then begin
    write(NO);
    halt(0);
end;
for i:=1 to n do
    l[i]:=i;
for i:=1 to m do begin
    read(x,y);
    un(x,y);
end;
for i:=1 to n do
    g[i]:=go(i);
tt := n - 1;
for i:=1 to tt do
    if g[i] <> g[i + 1] then begin
        write(NO);
        exit;
    end;
write(YES);
end.